daysInMonth :: (Int, Int) -> Int
daysInMonth (2, year) 
	| isLeapYear year 	= 29
	| otherwise			= 28
daysInMonth (month, year)
	| month == 1  = 31
	| month == 3  = 31
	| month == 4  = 30
	| month == 5  = 31
	| month == 6  = 30
	| month == 7  = 31
	| month == 8  = 31
	| month == 9  = 30
	| month == 10 = 31
	| month == 11 = 30
	| month == 12 = 31
daysInMonth x = 0	 --this should never happen
	
daysInYear :: Int -> Int
daysInYear year
	| isLeapYear year 	= 366
	| otherwise			= 365
	
isLeapYear :: Int -> Bool	
isLeapYear year
	| year `mod` 400 == 0 	= True
	| year `mod` 100 == 0   = False
	| year `mod` 4 == 0 	= True
	| otherwise				= False

daysSince1_1_1900 :: (Int, Int, Int) -> Int
daysSince1_1_1900 (day, 1, 1900) = day - 1
daysSince1_1_1900 (day, month, 1900) = daysSinceStartOfYear (day, month, 1900)
daysSince1_1_1900 (day, month, year) = daysSinceStartOfYear (day, month, year) + daysSince1900 year 
	
daysSinceStartOfYear :: (Int, Int, Int) -> Int
daysSinceStartOfYear (   0,     0, year ) 	= 0
daysSinceStartOfYear (   0, month, year ) 	= daysInMonth ( month, year ) + daysSinceStartOfYear ( 0, (month - 1), year )
daysSinceStartOfYear ( day, month, year ) 	= day + daysSinceStartOfYear ( 0, month - 1, year ) - 1
	
daysSince1900 :: Int -> Int
daysSince1900 1900 = 0
daysSince1900 n
	| isLeapYear (n - 1) = 366 + daysSince1900 ( n - 1 )
	| otherwise 		 = 365 + daysSince1900 ( n - 1 )
	
euler_019 = length $ filter (==6) $ map ((`mod` 7).daysSince1_1_1900) [(1,month,year)|year<-[1901..2000],month<-[1..12]]